package com.wenwei.activity;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;


import com.wenwei.bean.ConfigBean;
import com.wenwei.parking.BaseActivity;
import com.wenwei.parking.Constant;
import com.wenwei.parking.R;
import com.wenwei.utils.RogerSPUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by nidalee on 2017/10/11.
 */

public class ActivityTv extends BaseActivity {
    @Bind(R.id.base_title)
    TextView baseTitle;
    @Bind(R.id.text)
    TextView text;

    private ConfigBean mConfigBean;

    @Override
    protected void init() {
        super.init();
        mConfigBean = RogerSPUtils.getObject(mContext, Constant.CONFIG,ConfigBean.class);
    }

    @Override
    protected void initView() {
        super.initView();
        if(mConfigBean == null){
            return;
        }
        switch (getIntent().getIntExtra("type",0)){
            case Constant.TEXT_TYPE_USE:
                //用户指南
                baseTitle.setText("使用指南");
                text.setText(Html.fromHtml(mConfigBean.getGuideUse()));
                break;
            case Constant.TEXT_TYPE_DOC:
                //用户指南
                baseTitle.setText("公司介绍");
                text.setText(Html.fromHtml(mConfigBean.getAboutUs()));
                break;
            case Constant.TEXT_TYPE_REGISTER:
                baseTitle.setText("用户协议");
                text.setText(Html.fromHtml(mConfigBean.getRegistAgreement()));
                break;


        }
    }

    @Override
    public int setLayoutResourceId() {
        return R.layout.activity_tv;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.base_back)
    public void onViewClicked() {
        finish();
    }
}
